package by.euanpa.android.grodnobusstop.loader;

import java.util.List;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.content.Loader;
import by.euanpa.android.grodnobusstop.bo.BusStop;

public class UpdateDbReceiver extends BroadcastReceiver{

	public static final String ACTION_BUS_STOP_UPDATE = "actionbusstopupdate";
	
	private Loader<List<BusStop>> loader;
	private IntentFilter filter;
	
	public UpdateDbReceiver(Loader<List<BusStop>> loader) {
		this.loader = loader;
		filter = new IntentFilter(ACTION_BUS_STOP_UPDATE);
	}
	
	@Override
	public void onReceive(Context context, Intent intent) {
		if(intent.getAction().equals(ACTION_BUS_STOP_UPDATE)){
			loader.onContentChanged();
		}
	}

	public IntentFilter getFilter() {
		return filter;
	}
}